/*
 * BSM6.0
 *
 * Copyright 2012-2013 (C) SINODATA CO., LTD. All Rights Reserved.
 */
package com.sinodata.bsm.cicp.service;

import org.apache.log4j.Logger;

import com.sinodata.bsm.cicp.task.TaskManager;

/**
 * <p>
 * Description: 
 * </p>
 *
 * @author wangyazhou
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2013-6-24 下午3:36:30          wangyazhou        1.0         To create
 * </p>
 *
 * @since 
 * @see     
 */
public class TaskControlService extends Thread {
    private static final Logger logger = Logger.getLogger(TaskControlService.class);

    private static TaskControlService instance = null;

    private TaskControlService() {

    }

    public static TaskControlService getInstance() {
        if (instance == null) {
            instance = new TaskControlService();
        }
        return instance;
    }

    @Override
    public void run() {
        while (true) {
            try {
                TaskManager.getInstance().killSuspendedTask();
            } catch (Exception e) {
                e.printStackTrace();
            }
            try {
                Thread.sleep(5 * 60 * 1000L);
            } catch (Exception e) {

            }
        }
    }

}
